part of '../repository.dart';

const _kRuLearningLocaleValue = 'ru';

class _LearningLocaleDto extends Equatable {
  const _LearningLocaleDto._internal({
    required this.learningLocaleString,
  });

  final String learningLocaleString;

  @override
  List<Object?> get props {
    return [
      learningLocaleString,
    ];
  }

  factory _LearningLocaleDto.fromString(String learningLocaleString) {
    return _LearningLocaleDto._internal(
      learningLocaleString: learningLocaleString,
    );
  }

  factory _LearningLocaleDto.fromEntity(LearningLocale learningLocale) {
    final learningLocaleString = switch (learningLocale) {
      LearningLocale.ru => _kRuLearningLocaleValue,
    };

    return _LearningLocaleDto._internal(
      learningLocaleString: learningLocaleString,
    );
  }

  @override
  String toString() {
    return learningLocaleString;
  }

  LearningLocale toEntity() {
    return switch (learningLocaleString) {
      _kRuLearningLocaleValue => LearningLocale.ru,
      _ => throw UnimplementedError(),
    };
  }
}
